import { Pipe, PipeTransform } from '@angular/core';
import { AdminService } from '../services/admin.service';

@Pipe({
	name: 'authNodeInfo',
	pure: true,
})
export class AuthNodeInfoPipe implements PipeTransform {
	constructor(private adminService: AdminService) {}
	auth_nodes$ = this.adminService.auth_nodes().toPromise();
	async transform(auth_node_id: number) {
		const auth_nodes = await this.auth_nodes$;
		return auth_nodes.find(auth_node => auth_node.id === auth_node_id);
	}
}
